﻿using UnityEngine;
using System.Collections;

public class move_camera : MonoBehaviour {



	public Vector3 pos;
	public float size;
    public float speed = 0.1f;

	GameObject camera;
	GameObject cam_root;
    float camSize;

    public bool start;


	// Use this for initialization
	void Awake () 
	{
		cam_root = GameObject.Find("Cam_root");
		camera = GameObject.Find("Camera");
	}


	void Update()
	{
        if (start)
        {
            cam_root.transform.position = Vector3.Lerp(cam_root.transform.position, pos , speed);
            camSize = camera.GetComponent<Camera>().orthographicSize;
            camera.GetComponent<Camera>().orthographicSize = Mathf.Lerp(camSize, size, speed);
            
            if (Input.touchCount > 0 && camSize > (size - 0.2f)) start = false;
            
        }      
	}
}
